﻿using System;
using UnityEngine;

namespace ParticlePlayground
{
	// Token: 0x020001A6 RID: 422
	[Serializable]
	public class PlaygroundSave
	{
		// Token: 0x060009AE RID: 2478 RVA: 0x00048C40 File Offset: 0x00046E40
		public virtual bool IsLoading()
		{
			return this.isLoading;
		}

		// Token: 0x060009AF RID: 2479 RVA: 0x00048C48 File Offset: 0x00046E48
		public virtual bool IsSaving()
		{
			return this.isSaving;
		}

		// Token: 0x060009B0 RID: 2480 RVA: 0x00048C50 File Offset: 0x00046E50
		public virtual void Load(PlaygroundParticlesC loadTo)
		{
			if (this.loadMaterial && (this.setMaterialAfterTransition || !loadTo.loadTransition) && this.settings.particleSystemRenderer.sharedMaterial != null)
			{
				loadTo.particleSystemRenderer.sharedMaterial = this.settings.particleSystemRenderer.sharedMaterial;
			}
			this.isLoading = true;
			PlaygroundC.RunAsync(delegate()
			{
				switch (this.loadMode)
				{
				case 0:
					this.settings.CopyTo(loadTo);
					loadTo.playgroundCache = this.settings.snapshotData.Clone();
					break;
				case 1:
					this.settings.CopyTo(loadTo);
					break;
				case 2:
					loadTo.playgroundCache = this.settings.snapshotData.Clone();
					break;
				default:
					this.settings.CopyTo(loadTo);
					loadTo.playgroundCache = this.settings.snapshotData.Clone();
					break;
				}
				this.isLoading = false;
			});
			if (this.loadTransform)
			{
				this.transform.GetFromTransform(loadTo.particleSystemTransform);
			}
		}

		// Token: 0x060009B1 RID: 2481 RVA: 0x00048D0C File Offset: 0x00046F0C
		public virtual void Save(PlaygroundParticlesC playgroundParticles)
		{
			this.isSaving = true;
			this.transform = new PlaygroundTransformC();
			this.transform.SetFromTransform(playgroundParticles.particleSystemTransform);
			this.settings.particleSystemRenderer.sharedMaterial = playgroundParticles.particleSystemRenderer.sharedMaterial;
			playgroundParticles.CopyTo(this.settings);
			this.settings.snapshotData = playgroundParticles.playgroundCache.Clone();
			this.isSaving = false;
		}

		// Token: 0x060009B2 RID: 2482 RVA: 0x00048D80 File Offset: 0x00046F80
		public virtual void SaveAsync(PlaygroundParticlesC playgroundParticles)
		{
			this.isSaving = true;
			this.transform = new PlaygroundTransformC();
			this.transform.SetFromTransform(playgroundParticles.particleSystemTransform);
			this.settings.particleSystemRenderer.sharedMaterial = playgroundParticles.particleSystemRenderer.sharedMaterial;
			PlaygroundC.RunAsync(delegate()
			{
				playgroundParticles.CopyTo(this.settings);
				this.settings.snapshotData = playgroundParticles.playgroundCache.Clone();
				this.isSaving = false;
			});
		}

		// Token: 0x060009B3 RID: 2483 RVA: 0x00048DFC File Offset: 0x00046FFC
		public virtual PlaygroundSave Clone()
		{
			PlaygroundSave playgroundSave = new PlaygroundSave();
			this.settings.CopyTo(playgroundSave.settings);
			playgroundSave.name = this.name;
			playgroundSave.time = this.time;
			playgroundSave.lifetime = this.lifetime;
			playgroundSave.particleCount = this.particleCount;
			playgroundSave.loadMode = this.loadMode;
			playgroundSave.loadTransform = this.loadTransform;
			playgroundSave.loadMaterial = this.loadMaterial;
			playgroundSave.setMaterialAfterTransition = this.setMaterialAfterTransition;
			playgroundSave.material = this.material;
			playgroundSave.transitionMultiplier = this.transitionMultiplier;
			playgroundSave.transitionType = this.transitionType;
			playgroundSave.unfolded = this.unfolded;
			return playgroundSave;
		}

		// Token: 0x04000B16 RID: 2838
		[HideInInspector]
		public string name;

		// Token: 0x04000B17 RID: 2839
		[HideInInspector]
		public float time;

		// Token: 0x04000B18 RID: 2840
		[HideInInspector]
		public float lifetime;

		// Token: 0x04000B19 RID: 2841
		[HideInInspector]
		public int particleCount;

		// Token: 0x04000B1A RID: 2842
		[HideInInspector]
		public float version;

		// Token: 0x04000B1B RID: 2843
		[HideInInspector]
		public PlaygroundParticlesC settings;

		// Token: 0x04000B1C RID: 2844
		[HideInInspector]
		public PlaygroundTransformC transform;

		// Token: 0x04000B1D RID: 2845
		[HideInInspector]
		public Material material;

		// Token: 0x04000B1E RID: 2846
		[HideInInspector]
		public int loadMode;

		// Token: 0x04000B1F RID: 2847
		[HideInInspector]
		public bool loadTransform = true;

		// Token: 0x04000B20 RID: 2848
		[HideInInspector]
		public bool loadMaterial = true;

		// Token: 0x04000B21 RID: 2849
		[HideInInspector]
		public bool setMaterialAfterTransition = true;

		// Token: 0x04000B22 RID: 2850
		[HideInInspector]
		public float transitionMultiplier = 1f;

		// Token: 0x04000B23 RID: 2851
		[HideInInspector]
		public INDIVIDUALTRANSITIONTYPEC transitionType;

		// Token: 0x04000B24 RID: 2852
		[HideInInspector]
		public bool unfolded;

		// Token: 0x04000B25 RID: 2853
		protected bool isLoading;

		// Token: 0x04000B26 RID: 2854
		protected bool isSaving;
	}
}
